/* Triangle.h  -- triangle representation 

Copyright (C) 2010 Gabriel Alises Cano, Javier Angulo Lucerón

This file is part of Computer Graphics : Final Project 09-10.

Computer Graphics : Final Project 09-10 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Computer Graphics : Final Project 09-10 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Computer Graphics : Final Project 09-10.  If not, see <http://www.gnu.org/licenses/>. */

#ifndef TRIANGLE_H
#define TRIANGLE_H

#include "Vertex3D.h"
#include "Util.h"
#include "Types.h"
#include <vector>

using namespace std;

class Triangle {

 private:
	/** \brief Vertex */
  Vertex3D* _verts[3];
	/** \brief Normal vector of the triangle */
  GLdouble _normal[3];
	/** Indicate the state of the triangle*/
	TState state;	

 public:
  Triangle ();
  Triangle (const Triangle& f);
  Triangle (Vertex3D** vertices);
  ~Triangle ();

	/** \brief Get the index'th vertex */
  Vertex3D* vertex (int index) const;
	TState get_state ();
	void set_state (TState st);
	/** \brief Recalculate the normal vector */
	void compute_normal ();
	/** \brief Obtain the normal vector */
  GLdouble* normal();
	Vertex3D normalv();
	/** \brief Determines if triangle t is adyacent */ 
	bool adyacent(Triangle * t);
};

#endif
